package zhklappoint.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import zhklappoint.dao.WxInfoDao;
import zhklappoint.entity.UserActivityMid;
import zhklappoint.entity.WxInfo;
import zhklappoint.enums.ENUM_ISDELETE;
import zhklappoint.service.WxInfoService;
import zhklappoint.util.PageUtils;

@Service
public class WxInfoServiceImpl implements WxInfoService{
	
	@Autowired
	WxInfoDao wxDao;

	@Override
	public Page<WxInfo> findAllObj(WxInfo wxinfo,Integer page,Integer size) {
        Pageable pageable= PageUtils.toPageable(page, size, Sort.Direction.DESC, "updateTime");
        ExampleMatcher matcher=ExampleMatcher.matching()
                .withMatcher("title", ExampleMatcher.GenericPropertyMatchers.contains())
                .withMatcher("wxname", ExampleMatcher.GenericPropertyMatchers.contains());
        Example<WxInfo> example = Example.of(wxinfo, matcher);
        return wxDao.findAll(example, pageable);
	}
	
}
